﻿package game.exchangeddata 
{
	/**
	 * ...
	 * @author Doan Nguyen Thuy Nha Truc (Bamboo)
	 */
	import flash.xml.XMLNode;
	
	public class SoundInfo
	{
		private var arrID:Array;
		private var sourcelink:Array;
		private var sourcelinkCN:Array;
		
		public var hashTable:HashTable;
		public function SoundInfo() 
		{
			this.arrID = new Array();
			this.sourcelink = new Array();
			this.sourcelinkCN = new Array();
			
		}
		/**
		 * @author	Bamboo
		 * @param	xmlNode
		 * @param	lang
		 */
		public function updateInfo(xmlNode:XMLNode, lang:String):void {
			if (xmlNode == null)
				return;
			var lengthXML:Number = xmlNode.childNodes.length;
			var id,link,linkCN:String;
			//qtrace("lengthXML:" + lengthXML);
			for (var i:Number = 0; i<lengthXML; i++) {
				id = xmlNode.childNodes[i].attributes.id;
				this.arrID.push(id);
				link = xmlNode.childNodes[i].attributes["sourcelink"];
				this.sourcelink.push(link);
				linkCN = xmlNode.childNodes[i].attributes["sourcelinkCN"];
				this.sourcelinkCN.push(linkCN);
				
			}
			if(lang == "G" || lang == "B"){
				hashTable = new HashTable(arrID, sourcelinkCN);
			} else {
				hashTable = new HashTable(arrID, sourcelink);
			}	
			
		}
	}

}